package TestController;

import static org.junit.Assert.*;
import java.util.ArrayList;
import org.junit.Test;
import Task28.Command;
import Task28.Controller;
import Task28.Result;

public class TestDelete {

	Result result = new Result();
	Command command = new Command();
	Controller tester = new Controller();

	private void init() {
		command.setNameCommand("delete");
		command.setWorkDir("C:\\TEST2");
	}
	@Test
	public void test() {
		init();
		String[] args = null;
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(!aResult.isEmpty());
	}
	@Test
	public void test1() {
		init();
		String[] args = { "" };
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(!aResult.isEmpty());
	}

	@Test
	public void test2() {
		init();
		String[] args = { "","" };
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(!aResult.isEmpty());
	}
	@Test
	public void test3() {
		init();
		String[] args = { "notExistDir2" };//not exist
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(!aResult.isEmpty());
	}
	@Test
	public void test4() {
		init();
		String[] args = { "1111" };//exist dir
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(aResult.isEmpty());
	}
	@Test
	public void test5() {
		init();
		String[] args = { "proga2.exe" };//exist file
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(aResult.isEmpty());
	}
	@Test
	public void test6() {
		init();
		String[] args = { "notExist.exe" };//not exist file
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(!aResult.isEmpty());
	}
	@Test
	public void test7() {
		init();
		String[] args = { };
		command.setArgs(args);

		result = tester.getResult(command);
		ArrayList<String> aResult = new ArrayList<String>();
		aResult = result.getErrors();

		assertTrue(!aResult.isEmpty());
	}
}
